package com.gtq.uhome.util;

import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @author ylhy
 * @Describe 通过内置的Map(hasMap)来添加指定的信息和拓展的信息
 * 指定的code / msg / data
 * 拓展信息 put(K , V)
 * 得到 values
 * @create 2020-07-01 9:31
 */
@Component
public class MapUtil {
    private Map<String,Object> jsonMap;
    {
        jsonMap = new HashMap<>();
    }
    public void setCode(String code) {
        jsonMap.put("code",code);
    }
    public void setMsg(String msg) {
        jsonMap.put("msg",msg);

    }
    public void setData(Object data){
        jsonMap.put("data",data);
    }
    public void put(String key,Object value) {
        jsonMap.put(key,value);
    }
    public Map<String,Object> getValues() {
        return jsonMap;
    }
    public void clear(){
        jsonMap.clear();
    }

}
